/* sm_boat.h -- O barco
 *
 * Copyright (C) 2008, Diogo F. S. Ramos <diogo.ramos@usp.br>
 *                     Márcio Rogério
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef SM_BOAT_H_
#define SM_BOAT_H_

#include <GL/glut.h>

typedef struct sm_boat_t sm_boat_t;

struct sm_boat_t
{
    void (*draw)(void* self);
    GLfloat pos[3];
    GLfloat angle;
    GLfloat angle_inc;

    GLfloat bounce_sign;
    GLfloat bounce_inc;
    
    GLdouble base_cube_size;
    GLfloat base_mat_specular[4];
    GLfloat base_mat_diffuse[4];
    GLfloat base_mat_ambient[4];
    GLfloat base_mat_shininess;

    GLfloat cargo_door_angle;
    
    GLUquadric * mastro;
    GLdouble mastro_radius_base;
    GLdouble mastro_radius_top;
    GLdouble mastro_height;
    GLfloat mastro_mat_specular[4];
    GLfloat mastro_mat_diffuse[4];
    GLfloat mastro_mat_ambient[4];
    GLfloat mastro_mat_shininess;

    GLUquadric * mastro_sec;
    GLdouble mastro_sec_radius_base;
    GLdouble mastro_sec_radius_top;
    GLdouble mastro_sec_height;
    GLfloat mastro_sec_mat_specular[4];
    GLfloat mastro_sec_mat_diffuse[4];
    GLfloat mastro_sec_mat_ambient[4];
    GLfloat mastro_sec_mat_shininess;

    GLUquadric * mastro_frontal;
    GLdouble mastro_frontal_radius_base;
    GLdouble mastro_frontal_radius_top;
    GLdouble mastro_frontal_height;
    GLfloat mastro_frontal_mat_specular[4];
    GLfloat mastro_frontal_mat_diffuse[4];
    GLfloat mastro_frontal_mat_ambient[4];
    GLfloat mastro_frontal_mat_shininess;

    GLdouble deck_cube_size;
    GLfloat deck_mat_specular[4];
    GLfloat deck_mat_diffuse[4];
    GLfloat deck_mat_ambient[4];
    GLfloat deck_mat_shininess;

    GLdouble keel_cube_size;
    GLfloat keel_mat_specular[4];
    GLfloat keel_mat_diffuse[4];
    GLfloat keel_mat_ambient[4];
    GLfloat keel_mat_shininess;
    GLfloat keel_angle;

    GLUquadric * motor_prot_1;
    GLUquadric * motor_prot_2;
    GLUquadric * motor_turbo_1;
    GLUquadric * motor_turbo_2;
    GLdouble motor_prot_radius_base;
    GLdouble motor_prot_radius_top;
    GLdouble motor_prot_height;
    GLdouble motor_turbo_radius_base;
    GLdouble motor_turbo_radius_top;
    GLdouble motor_turbo_height;
    GLfloat motor_mat_specular[4];
    GLfloat motor_mat_diffuse[4];
    GLfloat motor_mat_ambient[4];
    GLfloat motor_mat_shininess;
    GLfloat motor_hel_cube_size;
    GLint motor_speed;
    GLfloat motor_angle;
    GLint motor_reverse;

    GLint anchored;
};

sm_boat_t * sm_boat_new(void);
void sm_boat_draw( sm_boat_t * boat );
void sm_boat_turn_left( sm_boat_t * self );
void sm_boat_turn_right( sm_boat_t * self );
void sm_boat_sail_forward( sm_boat_t * self );
void sm_boat_bounce( sm_boat_t * self );
void sm_boat_paint_mastro( sm_boat_t * self );
void sm_boat_paint_keel( sm_boat_t * self );
void sm_boat_paint_mastro_sec( sm_boat_t * self );
void sm_boat_paint_mastro_frontal( sm_boat_t * self );
void sm_boat_paint_base( sm_boat_t * self );
void sm_boat_cargo_door_move( sm_boat_t * self, const int direction );
void sm_boat_keel_move( sm_boat_t * self, const int direction );
void sm_boat_paint_motor( sm_boat_t * self );
void sm_boat_motor_set_speed( sm_boat_t * self, const int speed );
void sm_boat_motor_turn( sm_boat_t * self);
void sm_boat_motor_toggle_reverse( sm_boat_t * self );
void sm_boat_motor_turbo_increase( sm_boat_t * self );
void sm_boat_motor_turbo_decrease( sm_boat_t * self );
GLint sm_boat_motor_get_speed( sm_boat_t * boat );
GLfloat sm_boat_motor_turbo_get( sm_boat_t * self );
void sm_boat_toggle_anchor( sm_boat_t * self );


#endif	/* SM_BOAT_H_ */
